<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Contact extends CI_Controller {

	public function index($start = 0){
	   $this->load->model('Contacts', null, true);
       
       $this->load->library('pagination');
       $cofigPagination = $this->config->item('pagination');

        $config['base_url'] = base_url().'contact/index';
        $config['total_rows'] = $this->Contacts->getCount();
        $config['per_page'] = $cofigPagination['number_row']; 
        $this->pagination->initialize($config); 

        
       $data['Contacts'] = $this->Contacts->getList($start, $cofigPagination['number_row']);
	   $this->load->view('contact/index', $data);
	}
    
    /**
     * Delete customer
     * @author tien.nguyen
     */
    public function delete($contactId){
         $this->load->model('Contacts', null, true);
         if($this->Contacts->delete($contactId)){
            
            redirect(base_url().'contact.html');
         }
    }
    
    /**
     * edit save config id
     * @author tien.nguyen
     */
    public function view($contactId){
        $res = false;
        $this->load->model('Contacts', null, true);
        
        $data['Contact'] = $this->Contacts->getContact($contactId);
        $this->load->view('contact/view', $data);       
    }
    
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */